class ShortInputException(Exception):
    def __init__(self, length, atleast):
        # super().__init__()
        self.length = length
        self.atleast = atleast


while True:
    try:
        a = input("输入一个字符串：")
        if len(a) < 3:
            raise ShortInputException(len(a), 3)
    except ShortInputException as result:
        print("ShortInputException：输入的长度是%d,长度至少是:%d" % (result.length, result.atleast))
        break
    else:
        print("没有异常")
